<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./myAjax.js"></script>
    <script>
      window.onload = function (ev) {
        var oBtn = document.querySelector("button");
        oBtn.onclick = function (ev1) {
          Ajax(
            "04-ajax-get.php",
            {
              userName: "lmx",
              userPwd: "123456",
            },
            3000,
            function (xhr) {
              alert(xhr.responseText);
            },
            function (xhr) {
              alert("请求失败");
            }
          );
        };
      };
    </script>
  </head>
  <body>
    <button>发送请求</button>
  </body>
</html>
